<?php
# !!!!!!!!!! DON'T MAKE ANY CHANGE IF YOU DON'T KNOW WHAT YOU'RE DOING !!!!!!!!!!
// --------------------------------------------------------------------------------------------------------------
// File Name              :	activate.php
// Last Modification Time	:	2008-02-01 24:00
// Last Modified by       :	turker (turker.biz@gmail.com)
// list of modifications	:
//
//	- 2008-02-01 turker
//		* 24:00 file created.
//
// --------------------------------------------------------------------------------------------------------------
if (eregi("activate.php",$_SERVER['PHP_SELF'])) {
	header ("Location:../index.php");
	exit;
}

if (@empty($_GET['id'])||@empty($_GET['email'])||@empty($_GET['code'])) {
  header ("Location:$SITE_URL/index.php");
	exit;
}

?>
<!--div:icerik -->
    <div id="icerik">
      <p>
<?php
foreach ($_GET as $key=>$val) $_GET[$key]=$mysql->escape($val); # id, email, code
extract($_GET,EXTR_OVERWRITE);

$q=$mysql->query("select password,date from $USERS_TABLE where email='$email' and id='$id'");
if ($mysql->numRows($q)==1) {
  $password=$mysql->result($q,'passowrd');
  $date=$mysql->result($q,'date');
  $check=md5(md5($password.$date));

  if ($check==$code) {
    $level=1;
    if (!$USER_APPROVE) $level=2;
    $q=$mysql->query("update $USERS_TABLE set level='$level' where id='$id'");
    if (!$q) '<br />hata:2 - '.$_LANG['errors']['error1'].': '.$SITE_ADMIN_MAIL;
    else {
      if (!$USER_APPROVE) {
        echo '<br />'.$_LANG['activate']['regok'].'<br />';
        $message=$WELCOME_MAIL_BODY.'<br /><br />'.$MAIL_SIGNATURE;
        sendMail($email,$SITE_CONTACT_MAIL,$WELCOME_MAIL_HEADER,$message);
      }
      else echo '<br />'.$_LANG['activate']['prereg'].'<br />';
    } // else
  }
  else echo '<br />'.$_LANG['activate']['wcode'].'<br />';
}
else '<br />'.$_LANG['activate']['winfo'].'<br />';
?>
      </p>
    </div>
<!--//div:icerik -->